class ApplicationController < ActionController::Base
#   protect_from_forgery with: :exception , unless: -> { request.format.json? }
  protect_from_forgery with: :exception , unless: -> { request.format.json? ||

(request.host == "localhost" && Rails.env == "development")
                                                     }
end



# x rake db:drop && x rake db:migrate && rails c
# rails c
# Client ; p = { :room => "r o m" , :nicks => "a,b,c" } ; c = SimClient.create p ; p = { :room => "rr o m" , :nicks => "a,b,c" } ;  c2 = SimClient.create p ; p = { :room => "r oo m" , :nicks => "a,b,c" } ; i = IrcClient.create p ; p = { :nick => "anick" , :text => "some text" } ; m = c.messages.create p

# curl
# ROOM='r%20o%20m' ; SECRET='c73a8466a371335270b9874191e7c08e' ; curl -H "Content-Type: application/json" -X POST -d "{\"client\":{\"room\":\"$ROOM\",\"secret\":\"$SECRET\"}}" http://localhost:3000/clients/$ROOM/messages | head -n 12
